package com.jl.core.controller;

import cn.hutool.core.collection.CollectionUtil;
import com.jl.config.BaseResponse;
import com.jl.core.model.SzQueueInfoResp;
import com.jl.gongniu.model.dto.SzQueueInfo;
import com.jl.model.vo.CoalitionVo;
import com.jl.service.RoomInfoService;
import com.jl.utils.ObjectUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("gn")
@Slf4j
@Api(description = "斗公牛")
public class GongNiuController {

    @Autowired
    private RoomInfoService roomInfoService;

    @GetMapping("getBankList")
    @ApiOperation(value = "获取上庄队列")
    public BaseResponse<List<SzQueueInfoResp>> getCoalitionList(Integer roomId){
        List<SzQueueInfo> szInfo = roomInfoService.getSzInfo(roomId, SzQueueInfo.class);
        if (CollectionUtil.isNotEmpty(szInfo)){
            List<SzQueueInfoResp> szQueueInfoResp = ObjectUtils.convertList(szInfo, SzQueueInfoResp.class);
            return BaseResponse.success(szQueueInfoResp);
        }
        return BaseResponse.success();
    }

}
